/** GW Config.  This file holds various config values to support GeoWiki.
*/
if( typeof console != 'undefined' ){ console.debug('config.js'); }

/** Map defaults
These are used as the default lat/lon/zoom for maps when there is no more
appropriate value available.
*/
GW.map = {};
GW.map.lat = 37.0;
GW.map.lon = -85.0;
GW.map.zoom = 4;

// These need to be defined in both config.py and in gwconfig.js
GW.TYPE_ICON = 'icon';                                                          // Feature types
GW.TYPE_POLYLINE = 'line';
GW.TYPE_POLYGON = 'shape';
GW.POLY_WEIGHT = 2;                                                             // polyline and polygon defaults
GW.POLY_OPACITY = 0.6;
GW.POLY_FILLOPACITY = 0.2;
GW.POLY_COLOR = 'red';
GW.POLY_EDIT_SIZE = '20px';                                                     // size the marker & color icons in edit.html
GW.ICON = 'reddot';                                                             // default marker icon

// edit drawing options
GW.drawingOptions = {};

/** Layout defaults.
GeoWiki makes very heavy use of panels.  These values are used as the default
panel layout constants.  They assume a fairly wide high resolution screen.
*/
GW.layout = {};
var GWL = GW.layout;

// Default panel configurations for main and map panel layout
GWL.main = { width:'900px' };
GWL.map = { x:910 };

// Default panel configuration.
GWL.panelConfig = { 
    x: 5,
    y: 115,
    width: '600px',
    height: '650px',
    visible: true,
    close: false
};

// panel configuration for main menu
GWL.mainMenu = {
    xy:[95,5],
    visible: true,
    close: false,
    constraintoviewport:true,
    width: '345px',
    height: '95px'};
        
// panel configurations for list GeoWiki page
GWL.listExtra = { 
    xy: [445,10],
    width: '600px',
    height: '105px',
    visible: true,
    close: false };
GWL.listList = { close:false, width:'900px', y:120 };
GWL.listMap = {x:910, y:120, close:false };

// panel configurations for edit GeoWiki page
GWL.editExtra = { 
    xy: [445,10],
    width: '950px',
    height: '125px',
    visible: true,
    close: false };
GWL.editMain = { 
    y: 145,
    width:'500px', 
    close: false };
GWL.editMainNoFeatures = { 
    y: 145,
    width:'1000px', 
    close: false };
GWL.editMap = { 
    y: 145,
    x: 510, 
    width: '500px',
    close: false };
GWL.editFeature = { 
    y: 145,
    x: 1015, 
    width: '400px',
    visible: true,
    close: false };
    
/** Note: There is a resizeConfig held in local storage in gwpanels that 
* does not work if moved into config.  See gwpanels.js.
*/

// YUI RTE editor config
GWL.YUIRTEConfig = {
    width: '495px',
    height: '525px',
    animate: true,
    dompath: true,
    filterWord: true,
    resize: true,
    focusAtStart: true,
    //
    toolbar: {
        grouplabels: true,                                                      // turn off group labels
        buttons: [
            { group: 'fontstyle', label: 'Font Name & Size',
                buttons: [
                    { type: 'select', label: 'Arial', value: 'fontname', disabled: true,
                        menu: [
                            { text: 'Arial', checked: true },
                            { text: 'Arial Black' },
                            { text: 'Comic Sans MS' },
                            { text: 'Courier New' },
                            { text: 'Lucida Console' },
                            { text: 'Tahoma' },
                            { text: 'Times New Roman' },
                            { text: 'Trebuchet MS' },
                            { text: 'Verdana' }
                        ]
                    },
                    { type: 'spin', label: '13', value: 'fontsize', range: [ 9, 75 ], disabled: true }
                ]
            },
            { type: 'separator' },
            { group: 'textstyle', label: 'Font Style',
                buttons: [
                    { type: 'push', label: 'Bold CTRL + SHIFT + B', value: 'bold' },
                    { type: 'push', label: 'Italic CTRL + SHIFT + I', value: 'italic' },
                    { type: 'push', label: 'Underline CTRL + SHIFT + U', value: 'underline' },
                    { type: 'separator' },
                    //{ type: 'push', label: 'Subscript', value: 'subscript', disabled: true },             // no subscripting
                    //{ type: 'push', label: 'Superscript', value: 'superscript', disabled: true },         // no superscripting
                    //{ type: 'separator' },                                                                // do not need seperator
                    { type: 'color', label: 'Font Color', value: 'forecolor', disabled: true },
                    { type: 'color', label: 'Background Color', value: 'backcolor', disabled: true },
                    { type: 'separator' },
                    { type: 'push', label: 'Remove Formatting', value: 'removeformat', disabled: true },
                    { type: 'push', label: 'Show/Hide Hidden Elements', value: 'hiddenelements' }
                ]
            },
            { type: 'separator' },
            { group: 'alignment', label: 'Alignment',
                buttons: [
                    { type: 'push', label: 'Align Left CTRL + SHIFT + [', value: 'justifyleft' },
                    { type: 'push', label: 'Align Center CTRL + SHIFT + |', value: 'justifycenter' },
                    { type: 'push', label: 'Align Right CTRL + SHIFT + ]', value: 'justifyright' },
                    { type: 'push', label: 'Justify', value: 'justifyfull' }
                ]
            },
            { type: 'separator' },
            { group: 'parastyle', label: 'Paragraph Style',
                buttons: [
                { type: 'select', label: 'Normal', value: 'heading', disabled: true,
                    menu: [
                        { text: 'Normal', value: 'none', checked: true },
                        { text: 'Header 1', value: 'h1' },
                        { text: 'Header 2', value: 'h2' },
                        { text: 'Header 3', value: 'h3' },
                        { text: 'Header 4', value: 'h4' },
                        { text: 'Header 5', value: 'h5' },
                        { text: 'Header 6', value: 'h6' }
                    ]
                }
                ]
            },
            { type: 'separator' },
            { group: 'indent', label: 'Indenting',
                buttons: [
                    { type: 'push', label: 'Indent', value: 'indent', disabled: true },
                    { type: 'push', label: 'Outdent', value: 'outdent', disabled: true }
                ]
            },
            { type: 'separator' },
            { group: 'list', label: 'Lists',
                buttons: [
                    { type: 'push', label: 'Create an Unordered List', value: 'insertunorderedlist' },
                    { type: 'push', label: 'Create an Ordered List', value: 'insertorderedlist' }
                ]
            },
            { type: 'separator' },
            { group: 'insertitem', label: 'Insert Item',
                buttons: [
                    { type: 'push', label: 'HTML Link CTRL + SHIFT + L', value: 'createlink', disabled: true },
                    { type: 'push', label: 'Insert Image', value: 'insertimage' }
                ]
            }
        ]
    }
};

// Tiny MCE configuration used by GW.  See tinyMCE configuration docs.
GW.tinyMCEConfig = {
    mode : "exact",
    elements : "idContent",
    theme : "advanced",
    // Theme options
    theme_advanced_toolbar_location : "top",
    theme_advanced_toolbar_align : "left",
    theme_advanced_statusbar_location : "bottom",
    theme_advanced_resizing : true,
    // theme_advanced_resize_horizontal : false,
    // Setup plugins and buttons
    plugins: "safari,style,table,advimage,advlink,emotions," + 
        "inlinepopups,insertdatetime,preview,media,searchreplace,print," + 
        "contextmenu,paste,directionality,fullscreen,noneditable,visualchars," + 
        "nonbreaking,xhtmlxtras,template",
    theme_advanced_buttons1 : "bold,italic,underline,strikethrough,styleprops,|,"+
        "justifyleft,justifycenter,justifyright,justifyfull,|,"+
        "styleselect,formatselect,fontselect,fontsizeselect,help,",
    theme_advanced_buttons2 : "bullist,numlist,|,outdent,indent,blockquote,|," + 
        "insertdate,inserttime,preview,|,forecolor,backcolor,|," + 
        "link,unlink,anchor,image,|,cite,abbr,acronym,del,ins,|," + 
        "visualchars,nonbreaking,template,blockquote",
    theme_advanced_buttons3 : "tablecontrols,visualaid,|,"+
        "hr,|,charmap,emotions,media,|,"+
        "print,|,ltr,rtl,|,fullscreen",
    theme_advanced_buttons4 : "cut,copy,paste,pastetext,pasteword,|,"+
        "search,replace,|,undo,redo,|,code,removeformat,cleanup,",
    //oninit: 'GW.initContinue',
    // Use our CSS
    content_css : "/static/css/base.css",
    // Our templates
    // templates
    template_templates: [
        { title: "Anchorage",
          src: "/static/wikitemplates/two.html",
          description: "A basic template for describing an anchorage"
        }
    ]
};

/** Set to say successfully loaded
*/
GW.configLoaded = true;

if( typeof console != 'undefined' ){ console.debug('config.js loaded'); }
